<!--
 * Copyright ©
 * #  
 * @author: zw
 * @date: 2021-11-09 
 -->


<template>
  <div class="mb-12">
    <cons-card :name="month.name" :allIndex="Number(month.all)"></cons-card>

    <ConsList :data="month"></ConsList>
  </div>
</template>

<script lang='js'>
import { defineComponent, onMounted, onActivated, ref, computed } from "vue";
import { useStore } from "vuex";
import ConsList from "@/components/List/Week.vue";
import getData from "@/services";
export default defineComponent({
  name: "~Month",
  components: { ConsList },
  setup(props, { emit, slots }) {
    const store = useStore(),
    state = store.state,
    status = ref('');
    onMounted(() => {
      getData(store);
      status.value = state.consName;
    });
    onActivated(() => {
      if (status.value !== state.consName) {
        getData(store);
        status.value = state.consName;
      }
    });

    return {
      month: computed(() => state.month)
    };
  },
});

</script>

<style lang='css' scoped>

</style>
